package com.yykj.user.center.server.service.impl;

import com.yykj.tencent.im.client.feign.TencentImFeignClient;
import com.yykj.tencent.im.client.form.TpnsSendForm;
import com.yykj.user.center.server.emun.OrderType;
import com.yykj.user.center.server.service.TpnsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashSet;

@Slf4j
@Service
public class TpnsServiceImpl implements TpnsService {

    @Autowired
    TencentImFeignClient tencentImFeignClient;

    @Override
    public void sendPaySuccess(String doctorAccountId, int orderType) {
        HashSet<String> accountList = new HashSet<>();
        accountList.add(doctorAccountId);
        TpnsSendForm tpnsSendForm = TpnsSendForm.builder()
                .accountList(accountList)
                .title("您有一个新的" + OrderType.getDisplay(orderType) + "问诊订单,请您登录查看.")
                .content("").build();
        this.tencentImFeignClient.tpnsSend(tpnsSendForm);
    }
}
